function decrator(age:number){
    return (target:any) => {  //真正的装饰器
        console.log(target);
        target.prototype.age = age
    }  
}

//方法装饰器
function learnDec(target:any,key:string,descriptor:PropertyDescriptor){
    console.log(target,key,descriptor);
    descriptor.writable = false;  //不可写
}

//属性装饰器

function format(str:string){
    return (target:any,key:string) => {
        console.log(target,key)
    }
}

@decrator(11)
class People{
    @format("Hello, %s")
    name:string;
    constructor(name:string){
        this.name = name;
    }
    @learnDec
    learn(){
        console.log("====")
    }
}

let people1:any = new People('zs');


console.log(people1.learn())

// people1.learn = () => {}

console.log(people1.learn())
